package com.cl.blog.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

import lombok.Data;

/**
 * @TableName b_community_review
 */
@TableName(value = "b_community_review")
@Data
public class BCommunityReview implements Serializable {
	/**
	 *
	 */
	@TableId(type = IdType.AUTO)
	private Integer id;

	/**
	 * 社区评论表
	 */
	private String communityReviewContent;

	/**
	 * 父级id（用户id）
	 */
	private Integer parentId;
	private Integer userId;

	/**
	 * 社区id
	 */
	private Integer communityId;

	/**
	 *
	 */
	private LocalDateTime createTime;

	/**
	 * 评论状态，0（审核中），1（已发布）
	 */
	private String status;

	/**
	 *
	 */
	private Long likeCount;
	@TableField(exist = false)
	private BCommunity bCommunity;

	@TableField(exist = false)
	private static final long serialVersionUID = 1L;
	@TableField(exist = false)
	private BUser user;
	@TableField(exist = false)
	private BUser parent;
	@TableField(exist = false)
	private List<BCommunityReview> childCommunity;

	@Override
	public boolean equals(Object that) {
		if (this == that) {
			return true;
		}
		if (that == null) {
			return false;
		}
		if (getClass() != that.getClass()) {
			return false;
		}
		BCommunityReview other = (BCommunityReview) that;
		return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
				&& (this.getCommunityReviewContent() == null ? other.getCommunityReviewContent() == null : this.getCommunityReviewContent().equals(other.getCommunityReviewContent()))
				&& (this.getParentId() == null ? other.getParentId() == null : this.getParentId().equals(other.getParentId()))
				&& (this.getCommunityId() == null ? other.getCommunityId() == null : this.getCommunityId().equals(other.getCommunityId()))
				&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
				&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
				&& (this.getLikeCount() == null ? other.getLikeCount() == null : this.getLikeCount().equals(other.getLikeCount()));
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
		result = prime * result + ((getCommunityReviewContent() == null) ? 0 : getCommunityReviewContent().hashCode());
		result = prime * result + ((getParentId() == null) ? 0 : getParentId().hashCode());
		result = prime * result + ((getCommunityId() == null) ? 0 : getCommunityId().hashCode());
		result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
		result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
		result = prime * result + ((getLikeCount() == null) ? 0 : getLikeCount().hashCode());
		return result;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(getClass().getSimpleName());
		sb.append(" [");
		sb.append("Hash = ").append(hashCode());
		sb.append(", id=").append(id);
		sb.append(", communityReviewContent=").append(communityReviewContent);
		sb.append(", parentId=").append(parentId);
		sb.append(", communityId=").append(communityId);
		sb.append(", createTime=").append(createTime);
		sb.append(", status=").append(status);
		sb.append(", likeCount=").append(likeCount);
		sb.append(", serialVersionUID=").append(serialVersionUID);
		sb.append("]");
		return sb.toString();
	}
}